package nju.bean.meeting.transporter.Request;


import java.util.HashMap;

import nju.bean.meeting.UML.ClearingCommand;
import nju.bean.meeting.UML.Executable;
import nju.bean.meeting.data.User;
import nju.bean.meeting.meetingManagement.MainMeetingManager;
import nju.bean.meeting.meetingManagement.MeetingManager;
import nju.bean.meeting.transporter.Feedback.JudgeFeedback;

import org.junit.Test;

import junit.framework.TestCase;

public class DrawRequestTest extends TestCase {

	@Test
	public void test() {
		User raiser = new User();
		String userName = "nju";
		raiser.setUserName(userName);
		MainMeetingManager mainMeetingManager = MainMeetingManager.getInstance();
		HashMap<String, Object> meetingMap = 
				mainMeetingManager.newMeeting("testMeeting", 2 , raiser);
		String meetingId = (String) meetingMap.get("mId");
		MeetingManager mm = mainMeetingManager.matchMeeting(meetingId);
		
		Executable command = new ClearingCommand();
		DrawRequest request = new DrawRequest(command, userName);
		request.setManager(mm);
		JudgeFeedback fb = (JudgeFeedback) request.deal();
		assertTrue(fb.getResult());
	}

}
